package StringDemo;

public class StringBuilderDemo1 {

    public static void main(String[] args){
        StringBuilder str = new StringBuilder("你好");
        //StringBuilder在原有的字符串上修改，并未生成新的字符串常量和对象
        //str.append(",imooc");//append方法可在字符串后添加内容
        System.out.println(str.append(",imooc"));

        //字符串变成:你好，iMOOC
        //1.delete删除再插入
        System.out.println(str.delete(4,8));
        //System.out.println(str.insert(4,"MOOC"));
        //2.replace直接替换
        System.out.println(str.replace(4,8,"MOOC"));

    }
}
